<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css">

    <!-- 可选的Bootstrap主题文件（一般不用引入） -->
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap-theme.min.css">

    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="http://cdn.bootcss.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
</head>
<body>
    <div class="container-fluid">
        <form role="form" class="form-horizontal m-t" action="/user" method="POST">
           
            <div class="form-group">
                <label class="col-sm-3 control-label">姓名：</label>
                <div class="col-sm-6">
                    <input type="text"  name="name"  id="name" value=""  placeholder="姓名"/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">年龄：</label>
                <div class="col-sm-6">
                    <input type="text" name="age" id="age" value="" placeholder="年龄" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">性别：</label>
                <div class="col-sm-9">
                    
                <label class="checkbox-inline">
                    <input type="radio" name="sex"  value="1" >男
                </label>
                <label class="checkbox-inline">
                    <input type="radio" name="sex" value="2">女
                </label>
                           
                </div>
            </div>
            <div class="form-group draggable ui-draggable">
                <div class="col-sm-12 col-sm-offset-3">
                    <button class="btn btn-primary" type="button" id="save">保存</button>
                </div>
            </div>
        </form>

    </div>

  <script >
  $(function(){
    $("#save").click(function(){
		$.ajax({
			   type: "POST",
                dataType: "text",
                url: "/users/add",
				data:{"Name":$("#name").val(),"Age":$("#age").val(),"Sex":$("input[name='sex']:checked").val()},
                success:function(data){
                        if(data){
                            alert("新增成功")    
                        }

                }
		});
	});

  })
  </script>
    
    
</body>
</html>